package com.wenwan.manage.controller;

import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.wenwan.manage.service.UserFollowService;

import javax.annotation.Resource;

/**
 * 关注用户
 * 
 * @author Admin
 *
 */
@Controller
@RequestMapping(value = "/user/follow")
public class UserFollowController {

	@Autowired
	private UserFollowService userFollowService;

	@ResponseBody
	@RequestMapping(value = "/create", method = { RequestMethod.POST })
	public Map<String,Object> create(@RequestParam(required = true) String followerUserId,
			@RequestParam(required = true) String beFollowerUserId) {
		return userFollowService.create(followerUserId, beFollowerUserId);
	}

	@ResponseBody
	@RequestMapping(value = "/delete/by/id", method = { RequestMethod.POST })
	public Map<String,Object> deleteById(@RequestParam(required = true) String id) {
		return userFollowService.deleteById(id);
	}

	@ResponseBody
	@RequestMapping(value = "/select/all", method = { RequestMethod.GET })
	public Map<String,Object> selectAll(@RequestParam(required = true) String userId,
			@RequestParam(required = true) Boolean isFollower, @RequestParam(required = true) Boolean isBeFollower,
			@RequestParam(required = false, defaultValue = "1") Integer currentPage,
			@RequestParam(required = false, defaultValue = "10") Integer pageSize) {
		return userFollowService.selectAll(currentPage, pageSize, userId, isFollower, isBeFollower);
	}

}
